home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Original Code / Text and Fonts / NaiveFamiliesList / NaiveFamiliesList.cs next >
Encoding:
Text File  |  2001-01-15  |  926 b   |  32 lines

  1. //------------------------------------------------
  2. // NaiveFamiliesList.cs ⌐ 2001 by Charles Petzold
  3. //------------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class NaiveFamiliesList: PrintableForm
  9. {
  10.      public new static void Main()
  11.      {
  12.           Application.Run(new NaiveFamiliesList());
  13.      }
  14.      public NaiveFamiliesList()
  15.      {
  16.           Text = "Naive Font Families List";
  17.      }
  18.      protected override void DoPage(Graphics grfx, Color clr, int cx, int cy)
  19.      {
  20.           Brush        brush = new SolidBrush(clr);
  21.           float        y     = 0;
  22.           FontFamily[] aff   = FontFamily.Families;
  23.  
  24.           foreach (FontFamily ff in aff)
  25.           {
  26.                Font font = new Font(ff, 12);
  27.                grfx.DrawString(ff.Name, font, brush, 0, y);
  28.                y += font.GetHeight(grfx);
  29.           }
  30.      }
  31. }
  32.